package com.sc.nft.admin.controller;

import com.sc.nft.annotation.SysMemberLogin;
import com.sc.nft.entity.dto.LogisticsInquiryDTO;
import com.sc.nft.entity.vo.LogisticsVO;
import com.sc.nft.service.MallLogisticsService;
import com.sc.nft.sup.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/admin/mallLogistics")
@Api(tags = "订单物流")
public class MallLogisticsController {

    private final MallLogisticsService mallLogisticsService;

    @ApiOperation(value = "物流查询", notes = "物流查询", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/logisticsInquiry", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public Result<List<LogisticsVO>> logisticsInquiry(@RequestBody LogisticsInquiryDTO logisticsInquiryDTO) {
        return Result.success(mallLogisticsService.getByOrderIdAndLogisticsId(logisticsInquiryDTO.getOrderId(), logisticsInquiryDTO.getLogisticsId()));
    }

}
